#include <QCoreApplication>
#include "../operator.h"
#include <QPluginLoader>
#include <QDir>
#include <QMap>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QString pluginPath = QCoreApplication::applicationDirPath();
    QDir dir(pluginPath);
    QStringList filters;
    filters.append("*.dll");
    QMap<QString,Operator*> loadedOperators;
    for(auto file : dir.entryList(filters)) {
        QPluginLoader loader(file);
        if(loader.load()) {
            Operator *op = qobject_cast<Operator*>(loader.instance());
            loadedOperators.insert(op->name(),op);
        }
    }
    for(auto it = loadedOperators.begin(); it != loadedOperators.end(); ++it) {
        qDebug() << it.key() << it.value()->Execute(10,10);
    }
    return a.exec();
}
